<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
	<link rel="stylesheet" type="text/css" href="/stylesheets/shopp_car.css">
</head>
<body>
  <!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Document</title>
  <link rel="stylesheet" type="text/css" href="/stylesheets/base.css">
  <link rel="stylesheet" type="text/css" href="/stylesheets/home.css">
  <link rel="stylesheet" type="text/css" href="/stylesheets/index.css">
  <style type="text/css" media="screen">
  

</style>
</head>
<body>
  <div id="all">
    <div id="top">
      <div id="topa">
        <ul>    
          <% for(var i =0 ;i<data.length;i++){%>
          <%if(data[i].a_name!=null){%>
                    <li id="a">欢迎*<a href="/gerenxinxi"><%=data[i].a_name%></a></li>
                    <li id="closeLogin"><a href="javascript:loginClose('<%=data[i].a_name%>')">退出登录</a></li>
                    <%break;%>
          <%}else if(i>3&&data[i].a_name==null){%>
          <li id="a"><a href="/login">亲！请登录</a></li>
           <%break;%>
          <%}%>
          <%}%>
        </ul>
      </div>
      <div id="topb">
        <ul>
          <li ><a href="/hregist">后台管理</a></li>
          <li id="b"><a href=""><img src="/images/sm_r7_c23.jpg">联系客服</a></li>
        </ul>
      </div>
    </div>
   <div id="logo">
      <div id="img3"><img src="/images/touz.png" style="height: 100px  "></div>
      <div id="img2"><img src="/images/tou.png" style="height: 100px  "></div>

      <div id="img"><img src="/images/logo1.png" alt=""></div>
      <div id="ming">JOINFIT</div>
    </div>
    <div id="head">
      <ul>
        <li><a href="/">首页</a></li>
        <li ><a href="javascript:shopp_car()">购物车</a></li>
        <li ><a href="javascript:dingdan()">查看订单</a></li>
        <li ><a href="/huiyuan">会员修改</a></li>
        <li ><a href="/zhuce">注册有礼</a></li>
        <li ><a href="/liaotian">聊天室</a></li>
      </ul>
    </div>

<div id="che">购物详情</div>

	<table id="shopp_car" border="1">
         <tr>
         	<td>商品图片</td>
          <td>商品名称</td>
          <td>商品数量</td>
          <td>修改数量</td>
          <td>商品单价</td>
          <td>商品总价</td>
          <td colspan="4">编辑</td>

         </tr>
		<% for(var i =0 ;i<data.length;i++){%>
    <%if(data[i].b_shopp==null){%>
      <%continue%>
      <%}%>
  			<tr>
  				<td class="shopp_carTu"><img src="/images/<%=data[i].b_shoppTu%>" alt="" class="shopp_carTu"></td>
          <td><%=data[i].b_shopp%></td>
  				<td><%=data[i].b_number%></td>
  				<td><input type="number" name="b_number" id="in<%=data[i].b_id%>"><br></td>
          <td><%=data[i].b_price%></td>
  				<td><%=data[i].b_price*data[i].b_number%></td>
  				<td><a href="/shopp_delete_handler?id=<%=data[i].b_id%>">删除</a></td>
  				<td><a href="javascript:updateNumk(<%=data[i].b_id%>,<%=i%>)">修改数量</a></td>
  				<td><a href="/shopp_jiezhang_handler?id=<%=data[i].b_id%>">结账付款</a></td>
          <td> <span id="NumberInfo<%=i%>" style="color:#f90b5c"></span></td>
   			</tr>
		<%} %>
  	</table>
<script>
	
	function updateNumk(t,i) {
		var input=document.getElementById("in"+t);
		var str=`/shopp_xiugai_handler?id=${t}&num=${input.value}`;
    if (input.value<=0) {
      document.getElementById("NumberInfo"+i).innerHTML="修改数量错误";
    }else{
		location.href=str;
	}
}
 function dingdan(){   //跳订单界面需先判断
      if (document.getElementById('closeLogin')!=null) {  //如果有退出登录的 表示用户已经登录 
        var str=`/dingdan`;
        location.href=str;
      }
    }
 function shopp_car(){   //跳转购物车需先判断
      if (document.getElementById('closeLogin')!=null) {  //如果有退出登录的 表示用户已经登录 
        var str=`/shopp_car`;
        location.href=str;
      }
    }
  function loginClose(t){
      var str=`/login_close_handler?name=${t}`;
      location.href=str;
    }
</script>

</body>
</html>